package nl.unimaas.games.tron.player.mcts;

import java.io.Serializable;

import nl.unimaas.games.tron.engine.Board;

@SuppressWarnings("serial")
public interface CutOffStrategy extends Serializable {
	public final static int UNTESTED = -1, UNDECIDED = 0, CURRENT_PLAYER_WON = 1, OTHER_PLAYER_WON = 2, DRAW = 3;
	
	public int getEnding(Node node, Board board);
	
	public final static CutOffStrategy SPACE = new CutOffStrategy() {		
		@Override
		public int getEnding(Node node, Board board) {
			if (node.connected)
				return UNDECIDED;
			
			if (node.spaceDiff == 0 || Double.isNaN(node.spaceDiff))
				return UNDECIDED;
			
			if (node.spaceDiff > 0)
				return CURRENT_PLAYER_WON;
			else
				return OTHER_PLAYER_WON;
		}
		
		@Override
		public String toString() {
			return "space";
		}
	};
}
